Skip to content

Fix incorrect generated key handling for explicit auto-increment values#38810

Open
somiljain2006 wants to merge 2 commits into
apache:masterfrom
somiljain2006:explicit-negative-autoincrement
Open

Fix incorrect generated key handling for explicit auto-increment values#38810
somiljain2006 wants to merge 2 commits into
apache:masterfrom
somiljain2006:explicit-negative-autoincrement

Conversation

@somiljain2006
Copy link
Copy Markdown
Contributor

@somiljain2006 somiljain2006 commented Jun 4, 2026

Fixes #38717

Changes proposed in this pull request:

When an INSERT specifies an explicit value for an auto-increment column, Proxy should not populate lastInsertId from that value. This aligns the behavior with MySQL and prevents incorrectly generated key responses for explicit values. Add regression test covering explicit negative auto-increment values.


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in the comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven. javadoc.skip -Dmaven. jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

@somiljain2006
Copy link
Copy Markdown
Contributor Author

@terrymanu Can you review this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INSERT with an explicit **negative** value into an AUTO_INCREMENT column through ShardingSphere-Proxy (MySQL) fails

1 participant